package com.yikes.srb.pojo.enums;

import com.yikes.srb.common.enums.ResultCodeInterface;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.io.Serializable;

/**
 * <p>
 *
 * </p>
 *
 * @Author: guanrong.yin
 * @Date: 2024/12/30 14:51
 * @Version: 1.0
 */
@Getter
@AllArgsConstructor
public enum ServiceWorkCodeEnum implements ResultCodeInterface, Serializable {

    DICT_HAS_CHILDREN_NOT_DEL("-10001", "字典下有子节点，不能删除"),

    MOBILE_NULL_ERROR("-202", "手机号不能为空"),

    MOBILE_ERROR("-203", "手机号不正确"),

    PASSWORD_NULL_ERROR("-204", "密码不能为空"),

    CODE_NULL_ERROR("-205", "验证码不能为空"),

    CODE_ERROR("-206", "验证码不正确"),

    MOBILE_EXIST_ERROR("-207", "手机号已被注册"),

    USER_BIND_IDCARD_EXIST_ERROR("-301", "身份证号码已绑定"),

    USER_NO_BIND_ERROR("-302", "用户未绑定"),
    USER_NO_AMOUNT_ERROR("-303", "用户信息未审核"),
    USER_AMOUNT_LESS_ERROR("-304", "您的借款额度不足"),
    LEND_INVEST_ERROR("-305", "当前状态无法投标"),
    LEND_FULL_SCALE_ERROR("-306", "已满标，无法投标"),
    NOT_SUFFICIENT_FUNDS_ERROR("-307", "余额不足，请充值"),

    ;

    private final String code;

    private final String msg;

    /**
     * 根据code获取msg
     *
     * @param code
     * @return
     */
    public static String getMsg(String code) {
        for (ServiceWorkCodeEnum value : ServiceWorkCodeEnum.values()) {
            if (value.code.equals(code)) {
                return value.msg;
            }
        }
        return null;
    }

}
